/*
 *  Copyright 2010 sonrisa.
 * 
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 * 
 *       http://www.apache.org/licenses/LICENSE-2.0
 * 
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 *  under the License.
 */

package com.zh.jbet.core.dto;

import com.zh.jbet.core.entity.Bet;
import com.zh.jbet.core.entity.Game;
import java.util.ArrayList;
import java.util.List;

/**
 *
 * @author sonrisa
 */
public class BetTable<T extends Game, U extends Bet> {

    private TableRow<T> gameHead;
    private List<TableRow<U>> bets;

    public BetTable(T item, List<T> children) {
        gameHead = new TableRow<T>(item, children);
        bets = new ArrayList<TableRow<U>>();
    }

    public void addBetRow(U item, List<U> children) {
        bets.add(new TableRow<U>(item, children));
    }

    public List<TableRow<U>> getBets() {
        return bets;
    }

    public void setBets(List<TableRow<U>> bets) {
        this.bets = bets;
    }

    public TableRow<T> getGameHead() {
        return gameHead;
    }

    public void setGameHead(TableRow<T> gameHead) {
        this.gameHead = gameHead;
    }

    public class TableRow<V> {
        private V item;
        private List<V> children;

        public TableRow(V item, List<V> children) {
            this.item = item;
            this.children = children;
        }

        public List<V> getChildren() {
            return children;
        }

        public V getItem() {
            return item;
        }
    }
}
